package com.anzia.reader;

import java.io.BufferedWriter;
import java.io.FileWriter;

/**
 *@ClassName BufferedWriter_Demo
 *@Description
 *@Author Anzia.
 *@Date 2021/4/9 17:17
 *@Version 1.0
 **/
public class BufferedWriter_Demo {
    public static void main(String[] args) throws Exception {
        //创建BufferedWriter对象
        FileWriter fw = new FileWriter("static\\buffer1.txt");
        BufferedWriter bw = new BufferedWriter(fw);

        //
        for (int i = 0; i < 10; i++) {
            bw.write("好好学习，天天向上");
            bw.newLine(); //写入一个换行符
            bw.flush();
        }

        //关闭
        bw.close();
        System.out.println("执行完毕！");
    }
}
